package com.sunshine.monitor.util;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IOUtils {
 
	public static void copy(InputStream is, OutputStream os) throws IOException {
		if (is == null || os == null)
			return;

		byte[] bytes = new byte[1024 * 512];

		int len;

		while ((len = is.read(bytes)) != -1) {
			os.write(bytes, 0, len);
		}
	}

	public static void closeStream(Closeable stream) throws IOException {
		if (stream != null) {
			stream.close();
		}
	}
}
